project(Registration)
cmake_minimum_required(VERSION 2.8)
find_package(CUDA 8.0 REQUIRED)
IF (CUDA_FOUND)
    include_directories("${CUDA_INCLUDE_DIRS}")
    # Optional: Specify the arch of your CUDA hardware here
	message(STATUS "find cuda")
    SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-O3;-std=c++11 -gencode arch=compute_61,code=sm_61)
ENDIF ()

SET("OpenCV_DIR" "D:/opencv/build_with_cuda")
find_package(OpenCV 3.0 REQUIRED)
if (OpenCV_INCLUDE_DIRS)
    include_directories("${OpenCV_INCLUDE_DIRS}")
    link_directories(${OpenCV_DIR}/lib)
endif (OpenCV_INCLUDE_DIRS)

#file(GLOB SurfaceMeasurment_SRC point_cloud_normal.cu)
cuda_add_library(SurfaceMeasurment point_cloud_normal.cu point_cloud_normal.h)
target_link_libraries(SurfaceMeasurment ${OpenCV_LIBS})

cuda_add_library(SurfaceRecistruction tsdf.cu tsdf.h)
target_link_libraries(SurfaceRecistruction ${OpenCV_LIBS})

cuda_add_library(ICP icp.cu icp.h)
target_link_libraries(ICP ${OpenCV_LIBS})

cuda_add_library(Voxel voxel.cu voxel.h)

find_package(PCL 1.8 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

add_library(DOX dox.h)
target_link_libraries(DOX 
                      ${OpenCV_LIBS}
					  ${PCL_LIBRARIES})

add_library(CoarseRegistration coarse_registration.h coarse_registration.cc)
target_link_libraries(CoarseRegistration ${PCL_LIBRARIES})

add_library(Registration registration_impl.h
                         registration_impl.cc)

target_link_libraries(Registration 
                      ${OpenCV_LIBS}
					  ${PCL_LIBRARIES}
					  SurfaceMeasurment
					  SurfaceRecistruction
					  CoarseRegistration
					  ICP)


add_executable(Registration_Lab registration_lab.cc)
target_link_libraries(Registration_Lab 
Registration
Voxel
ICP
${OpenCV_LIBS}
 ${PCL_LIBRARIES})